package com.example.companybusiness.operationt;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.example.companybusiness.R;
import com.example.companybusiness.operationt.adapter.SearchAdapter;
import com.example.companybusiness.operationt.bean.SearchBean;

import java.util.ArrayList;
import java.util.List;

public class MainActivityHome extends AppCompatActivity
{
    private TextView textView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_home);

        searchitem();//搜索列表
        searchTiaozhuan();
        searchDB();//搜索增删改查
    }
    private void searchitem()
    {

        RecyclerView recyclerView = findViewById(R.id.layout_main_home_rec_search);

        recyclerView.setLayoutManager(new LinearLayoutManager(this));

        List<SearchBean> searchBeanList = new ArrayList<>();

        for (int i = 0; i < 3; i++)
        {
            SearchBean searchBean = new SearchBean();
            searchBean.setSeach("老凤祥");
            searchBean.setDeleteA(R.mipmap.trash_can);
            searchBeanList.add(searchBean);
        }
        SearchAdapter searchAdapter = new SearchAdapter(this);
        searchAdapter.setData(searchBeanList);
        recyclerView.setAdapter(searchAdapter);
    }
    private void searchDB() {

    }
    private void searchTiaozhuan(){
        textView = findViewById(R.id.layout_main_home_tv_cancel);
        textView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                setResult(10);
                finish();
            }
        });
    }
}